package reflect;

import java.lang.reflect.Method;

public class ReflectDemo5 {
    public static void main(String[] args) throws Exception{
        Person p = new Person();
        p.say("大家好!");

        Class cls = Class.forName("reflect.Person");
        Object o =cls.newInstance();
        Method m = cls.getMethod("say", String.class);
        m.invoke(o,"大家好");
        Method m1 = cls.getMethod("say", String.class, int.class);
        m1.invoke(o,"呵呵",4);
    }
}
